package com.chmingx.admin.servlet;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * 注入Filter
 */
@WebFilter(urlPatterns = {"/css/*", "/images/*"}) // 要拦截的路由数组
public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("放行");
        filterChain.doFilter(servletRequest, servletResponse); // 放行
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
